package io.renren.modules.substation.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.substation.entity.TTotalMonthInfoEntity;
import io.renren.modules.substation.service.TTotalMonthInfoService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 变量统计月表
 *
 * @author yzx
 * @email sunlightcs@gmail.com
 * @date 2020-08-05 16:29:56
 */
@RestController
@RequestMapping("substation/ttotalmonthinfo")
public class TTotalMonthInfoController {
    @Autowired
    private TTotalMonthInfoService tTotalMonthInfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("substation:ttotalmonthinfo:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tTotalMonthInfoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("substation:ttotalmonthinfo:info")
    public R info(@PathVariable("id") Long id){
		TTotalMonthInfoEntity tTotalMonthInfo = tTotalMonthInfoService.getById(id);

        return R.ok().put("tTotalMonthInfo", tTotalMonthInfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("substation:ttotalmonthinfo:save")
    public R save(@RequestBody TTotalMonthInfoEntity tTotalMonthInfo){
		tTotalMonthInfoService.save(tTotalMonthInfo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("substation:ttotalmonthinfo:update")
    public R update(@RequestBody TTotalMonthInfoEntity tTotalMonthInfo){
		tTotalMonthInfoService.updateById(tTotalMonthInfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("substation:ttotalmonthinfo:delete")
    public R delete(@RequestBody Long[] ids){
		tTotalMonthInfoService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
